import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { WorkCateVO, WorkCateForm, WorkCateQuery } from '@/leadmall/api/workCate/types';

/**
 * 查询工作类型列表
 * @param query
 * @returns {*}
 */

export const listWorkCate = (query?: WorkCateQuery): AxiosPromise<WorkCateVO[]> => {
  return request({
    url: PORT +'/leadmall/workCate/list',
    method: 'get',
    params: query
  });
};

export const getWorkList = (query?: any): AxiosPromise<WorkCateVO[]> => {
  return request({
    url: PORT +'/leadmall/workCate/getWorkList',
    method: 'get',
    params: query
  });
};

/**
 * 查询工作类型详细
 * @param id
 */
export const getWorkCate = (id: string | number): AxiosPromise<WorkCateVO> => {
  return request({
    url: PORT +'/leadmall/workCate/' + id,
    method: 'get'
  });
};

/**
 * 新增工作类型
 * @param data
 */
export const addWorkCate = (data: WorkCateForm) => {
  return request({
    url: PORT +'/leadmall/workCate',
    method: 'post',
    data: data
  });
};

/**
 * 修改工作类型
 * @param data
 */
export const updateWorkCate = (data: WorkCateForm) => {
  return request({
    url: PORT +'/leadmall/workCate',
    method: 'put',
    data: data
  });
};

/**
 * 删除工作类型
 * @param id
 */
export const delWorkCate = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/workCate/' + id,
    method: 'delete'
  });
};
